<template>
	<view class="template">
		<view class="search_input">
			<uni-data-select class="uni_select" v-model="data.selectValue" :localdata="data.selectList"
				@change="getDataList"></uni-data-select>
			<uni-easyinput prefixIcon="search" @confirm="getDataList" @clear="getDataList" v-model="data.searchValue"
				placeholder="请输入模板名称">
			</uni-easyinput>
			<view class="add_btn" @click="addTemplate">
				新增模板
			</view>
		</view>
		<!-- <uni-load-more status="more"> -->
		<scroll-view :scroll-top="data.scrollTop" scroll-y="true" class="scroll_Y">
			<view class="scroll-view-item uni-bg-red" v-for="(item) in data.dataList" :key="item.id">
				<view class="templateInfo">
					<text class="type">{{item.patternDescribe}}</text>
					<text class="name">{{item.name}}</text>
				</view>
				<view class="templateBtn">
					<text @click='details(item.templateId)'>查看</text>
					<text class="del" @click='detele(item.templateId)'>删除</text>
				</view>
			</view>
		</scroll-view>
		<!-- </uni-load-more> -->
		<uni-popup ref="popup" class="withdrawal" :mask-click="false">
			<view class="popup-content">
				<div class="popup_title">
					添加模板
					<img @click="popup.close()" src="@/static/img/close.png" alt="" />
				</div>
				<view class="add_temelate">
					<uni-forms ref="baseForm" :modelValue="data.template">
						<uni-forms-item label="模板名称" required>
							<uni-easyinput v-model="data.template.Name" placeholder="请输入模板名称" />
						</uni-forms-item>
						<uni-forms-item label="模板类型" required>
							<view class="templateType" @click="popup1Fn(1,null)">{{data.template.PatternName}}
							</view>
						</uni-forms-item>
						<uni-forms-item label="模板声明">
							<uni-easyinput v-model="data.template.Remark" placeholder="请输入说明" />
						</uni-forms-item>
						<uni-forms-item label="sex" class="sex">
							<uni-data-checkbox v-model="data.template.isPersonalTemplate" :localdata="data.sexs" />
						</uni-forms-item>
					</uni-forms>
					<uni-collapse>
						<uni-collapse-item titleBorder="none"
							v-if="data.template.pattern == '7' || data.template.pattern == '0'">
							<template v-slot:title>
								<view class="collapseTitle">
									<img class="icons" src="@/static/img/mzbl.png" alt="" />
									病例模板
								</view>
							</template>
							<view class="content">
								<uni-forms ref="baseForm" class="caseForm" :modelValue="caseData.template">
									<uni-forms-item label="医疗类别" required>
										<view class="templateType" @click="popup1Fn(18,null)">
											{{caseData.template.medType || '请选择医疗类别'}}
										</view>
									</uni-forms-item>
									<uni-forms-item label="诊断:" required>
										<view class="templateType" @click="popup1Fn(19,null)">
											{{caseData.template.diagnosis || '请选择'}}
										</view>
									</uni-forms-item>
									<uni-forms-item label="过敏史:">
										<view class="templateType" @click="popup4Fn(1)">
											{{caseData.template.algsHis || '请输入'}}
										</view>
									</uni-forms-item>
									<uni-forms-item label="患者主诉:" class="sex">
										<view class="templateType" @click="popup4Fn(2)">
											{{caseData.template.chfcomp || '请输入'}}
										</view>
									</uni-forms-item>
									<uni-forms-item label="标签:" class="sex">
										<view class="templateType" @click="popup4Fn(3)">
											{{caseData.template.tagIds || '请输入'}}
										</view>
									</uni-forms-item>
									<uni-forms-item label="处置:">
										<div class="input">
											<uni-easyinput v-model="caseData.template.upperRight" placeholder="右上" />
											<uni-easyinput v-model="caseData.template.upperLeft" placeholder="左上" />
											<uni-easyinput v-model="caseData.template.lowerRight" placeholder="右下" />
											<uni-easyinput v-model="caseData.template.lowerLeft" placeholder="左下" />
										</div>
										<uni-easyinput type="textarea" autoHeight
											v-model="caseData.template.disposalContent"
											placeholder="请输入"></uni-easyinput>
									</uni-forms-item>
									<uni-forms-item label="现病史:">
										<uni-easyinput v-model="caseData.template.diseNow" placeholder="请输入" />
									</uni-forms-item>
									<uni-forms-item label="既往史:">
										<uni-easyinput v-model="caseData.template.pastHistory" placeholder="请输入" />
									</uni-forms-item>
									<uni-forms-item label="其他检查:">
										<uni-easyinput v-model="caseData.template.otherCheck" placeholder="请输入" />
									</uni-forms-item>
									<uni-forms-item label="望闻问切:">
										<uni-easyinput v-model="caseData.template.look" placeholder="请输入" />
									</uni-forms-item>
									<uni-forms-item>
									</uni-forms-item>
								</uni-forms>
							</view>
						</uni-collapse-item>
						<uni-collapse-item titleBorder="none"
							v-if="data.template.pattern == '2' || data.template.pattern == '0'">
							<template v-slot:title>
								<view class="collapseTitle">
									<img class="icons" src="@/static/img/zxcy.png" alt="" />
									西药中成药处方
								</view>
							</template>
							<view class="content">
								<view class="add_drug">
									<view class="search_drug">
										<uni-easyinput @confirm='drugSearch(drugData.drugValue)' prefixIcon="search"
											v-model="drugData.drugValue" placeholder="请输入药品名称/拼音简拼" />
									</view>
									<view class="search" @click.self="closeDrug" v-if="drugData.searchList.length > 0">
										<view class="search_result">
											<view class="search_item" @click.stop="addDrug(item)"
												v-for="item in drugData.searchList" :key="item.id">
												<view class="drug_text">
													<view class="drug_text_title">
														<text class="name">{{item.name}}</text>
														<text class="lable">零售价：</text>
														<text class="money">￥{{item.pric}}</text>
													</view>
													<view class="drug_text_desc">
														<text>{{item.specification}}</text>
														<text>{{item.manufacturer}}</text>
														<text>库存: {{item.inventoryMin}}</text>
													</view>
												</view>
											</view>
										</view>
									</view>
								</view>
								<view class="view_ul">
									<view class="view_li" v-for="(item,index) in drugData.drugList" :key="item.id">
										<view class="li_title">
											<view class="name">
												{{item.name}}
											</view>
											<view class="money">
												<text>单价:</text>
												<uni-easyinput clearSize="12" class="uni-mt-5" trim="all"
													v-model="item.pric" placeholder="请输入内容"></uni-easyinput>
												<text>元</text>
											</view>
											<view class="number">
												<uni-number-box :min="1" :value="item.cnt" />
												<text>{{item.unit}}</text>
											</view>
											<view class="detele">
												<img @click="drugChange(item)" src="@/static/img/delete.png" alt="" />
											</view>
										</view>
										<view class="li_desc">
											<text>{{item.specification}}</text>
											<text>{{item.manufacturer}}</text>
										</view>
										<view class="li_params">
											<view class="params">
												<text>剂型</text>
												<text class="value"
													@click="popup1Fn(2,index)">{{item.dosageForm || '选择剂型'}}</text>
											</view>
											<view class="params">
												<text>单次用量</text>
												<uni-easyinput class="uni-mt-5" v-model="item.rxDoscnt"
													placeholder="请输入"></uni-easyinput>
												<text class="value"
													@click="popup1Fn(3,index)">{{item.sinDosunt || '选择单位'}}</text>
											</view>
											<label v-if="false">
												<checkbox value="c" disabled="false" />拆零
											</label>
										</view>
										<view class="li_params">
											<view class="params">
												<text>频率</text>
												<text class="value"
													@click="popup1Fn(4,index)">{{item.rxFrquName || '选择频率'}}</text>
											</view>
											<view class="params">
												<text>天数</text>
												<uni-easyinput class="uni-mt-5" v-model="item.days"
													placeholder="请输入"></uni-easyinput>
											</view>
											<view class="params">
												<text>用法</text>
												<text class="value"
													@click="popup1Fn(5,index)">{{item.rxUsedWayName || '请选择'}}</text>
											</view>
										</view>
									</view>
								</view>
							</view>
						</uni-collapse-item>
						<uni-collapse-item titleBorder="none"
							v-if="data.template.pattern == '3' || data.template.pattern == '0'">
							<template v-slot:title>
								<view class="collapseTitle">
									<img class="icons" src="@/static/img/zycf.png" alt="" />
									中药处方
								</view>
							</template>
							<view class="content">
								<view class="prescription" v-for="(item,index) in prescriptionData.prescriptionList"
									:key="index">
									<view class="add_drug">
										<view class="search_drug">
											{{item.name}}<text class="title">{{index+1}}</text>
											<uni-easyinput @confirm='drugSearch(item.searchKey)' prefixIcon="search"
												v-model="item.searchKey" placeholder="请输入药品名称/拼音简拼" />
											<view class="del_btn" v-if="prescriptionData.prescriptionList.length > 1"
												@click="prescriptionData.prescriptionList.splice(index,1)">
												删除
											</view>
										</view>
										<view class="search" @click.self="closeDrug"
											v-if="drugData.searchList.length > 0 && item.searchKey">
											<view class="search_result">
												<view class="search_item" @click.stop="addPre(y,index)"
													v-for="y in drugData.searchList" :key="y.id">
													<view class="drug_text">
														<view class="drug_text_title">
															<text class="name">{{y.name}}</text>
															<text class="lable">零售价：</text>
															<text class="money">￥{{y.pric}}</text>
														</view>
														<view class="drug_text_desc">
															<text>{{y.specification}}</text>
															<text>{{y.manufacturer}}</text>
															<text>库存: {{y.inventoryMin}}</text>
														</view>
													</view>
												</view>
											</view>
										</view>
									</view>
									<view class="view_ul">
										<view class="view_li" v-for="(y,i) in item.details" :key="y.id">
											<view class="li_title">
												<view class="name">
													{{y.name}}
												</view>
												<view class="money">
													<text>单价:</text>
													<uni-easyinput clearSize="12" class="uni-mt-5" trim="all"
														v-model="y.pric" placeholder="请输入内容"></uni-easyinput>
													<text>{{y.unit}}</text>
												</view>
												<view class="number">
													<uni-number-box :min="1" :value="y.cnt" />
													<text>{{y.unit}}</text>
												</view>
												<view class="detele">
													<img @click="item.details.splice(i,1)" src="@/static/img/delete.png"
														alt="" />
												</view>
											</view>
											<view class="li_desc">
												<text>{{y.specification}}</text>
												<text>{{y.manufacturer}}</text>
											</view>
											<view class="li_params">
												<view class="params">
													<text>剂型</text>
													<text class="value"
														@click="popup1Fn(6,index,i)">{{y.dosageForm || '选择剂型'}}</text>
												</view>
												<view class="params">
													<text>特殊处理</text>
													<text class="value"
														@click="popup1Fn(7,index,i)">{{y.specialTreatment || '选择特殊处理'}}</text>
												</view>
											</view>
										</view>
									</view>
									<view class="params_box" v-if="item.details.length > 0">
										<view class="params_item">
											<text>总副数</text>
											<uni-easyinput clearSize="12" class="uni-mt-5" trim="all"
												v-model="item.quantity" placeholder="请输入内容"></uni-easyinput>
											<text>副</text>
										</view>
										<view class="params_item">
											<text>频率</text>
											<text class="value"
												@click="popup1Fn(8,index)">{{item.rxFrquName || '请选择'}}</text>
										</view>
										<view class="params_item">
											<text>天数</text>
											<uni-easyinput class="uni-mt-5" v-model="item.days"
												placeholder="请输入"></uni-easyinput>
											<text>天</text>
										</view>
										<view class="params_item">
											<text>用量</text>
											<text class="value"
												@click="popup1Fn(9,index)">{{item.dosage || '请选择'}}</text>
										</view>
										<view class="params_item">
											<text>用法</text>
											<text class="value"
												@click="popup1Fn(10,index)">{{item.rxUsedWayName || '请选择'}}</text>
										</view>
										<view class="params_item">
											<text>煎药方式</text>
											<uni-easyinput clearSize="12" class="uni-mt-5" trim="all"
												v-model="item.decoctingMethod" placeholder="请输入"></uni-easyinput>
										</view>
										<view class="params_item">
											<text>医嘱</text>
											<uni-easyinput clearSize="12" class="uni-mt-5" trim="all"
												v-model="item.doctorAdvice" placeholder="请输入医嘱"></uni-easyinput>
										</view>
									</view>
								</view>
								<view class="add_prescription" @click="addPrescription">
									加处方
								</view>
							</view>
						</uni-collapse-item>
						<uni-collapse-item titleBorder="none"
							v-if="data.template.pattern == '4' || data.template.pattern == '0'">
							<template v-slot:title>
								<view class="collapseTitle">
									<img class="icons" src="@/static/img/zscf.png" alt="" />
									注射处方
								</view>
							</template>
							<view class="content">
								<view class="injection" v-for="(item,index) in injection.injectionList" :key="index">
									<view class="add_drug">
										<view class="search_drug">
											{{item.name}}<text class="title">{{index+1}}</text>
											<uni-easyinput @confirm='drugSearch(item.searchKey)' prefixIcon="search"
												v-model="item.searchKey" placeholder="请输入药品名称/拼音简拼" />
											<view class="del_btn" v-if="injection.injectionList.length > 1"
												@click="injection.injectionList.splice(index,1)">
												删组
											</view>
										</view>
										<view class="search" @click.self="closeDrug"
											v-if="drugData.searchList.length > 0 && item.searchKey">
											<view class="search_result">
												<view class="search_item" @click.stop="addInje(y,index)"
													v-for="y in drugData.searchList" :key="y.id">
													<view class="drug_text">
														<view class="drug_text_title">
															<text class="name">{{y.name}}</text>
															<text class="lable">零售价：</text>
															<text class="money">￥{{y.pric}}</text>
														</view>
														<view class="drug_text_desc">
															<text>{{y.specification}}</text>
															<text>{{y.manufacturer}}</text>
															<text>库存: {{y.inventoryMin}}</text>
														</view>
													</view>
												</view>
											</view>
										</view>
									</view>
									<view class="view_ul">
										<view class="view_li" v-for="(y,i) in item.details" :key="y.id">
											<view class="li_title">
												<view class="name">
													{{y.name}}
												</view>
												<view class="money">
													<text>单价:</text>
													<uni-easyinput clearSize="12" class="uni-mt-5" trim="all"
														v-model="y.pric" placeholder="请输入内容"></uni-easyinput>
													<text>元</text>
												</view>
												<view class="number">
													<uni-number-box :min="1" :value="y.cnt" />
													<text>{{y.unit}}</text>
												</view>
												<view class="detele">
													<img @click="item.details.splice(i,1)" src="@/static/img/delete.png"
														alt="" />
												</view>
											</view>
											<view class="li_desc">
												<text>{{y.specification}}</text>
												<text>{{y.manufacturer}}</text>
											</view>
											<view class="li_params">
												<view class="params">
													<text>默认剂量</text>
													<uni-easyinput class="uni-mt-5" v-model="y.rxDoscnt" disabled
														placeholder=""></uni-easyinput>
													<!-- @click="popup1Fn(11,index,i)" -->
													<text class="value"
														style="color: #ccc;">{{y.rxUsedWayName || '请选择'}}</text>
												</view>
												<view class="params">
													<text>单次剂量</text>
													<uni-easyinput class="uni-mt-5" v-model="y.rxDoscnt"
														placeholder="请输入"></uni-easyinput>
													<text>{{y.unit}}</text>
												</view>

											</view>
											<view class="li_params">
												<view class="params">
													<text>剂型</text>
													<text class="value"
														@click="popup1Fn(11,index,i)">{{y.dosageForm || '选择剂型'}}</text>
												</view>
												<view class="params">
													<text>单次数量</text>
													<uni-easyinput class="uni-mt-5" v-model="y.rxDoscnt"
														placeholder="请输入"></uni-easyinput>
													<text>{{y.unit}}</text>
												</view>
												<label>
													<checkbox value="cb" :checked="y.skinTest" />皮试
												</label>
											</view>
										</view>
									</view>
									<view class="params_box" v-if="item.details.length > 0">
										<view class="params_item">
											<text>用法</text>
											<uni-easyinput clearSize="12" class="uni-mt-5" trim="all"
												v-model="item.rxUsedWayName" placeholder="请输入内容"></uni-easyinput>
										</view>
										<view class="params_item">
											<text>频率</text>
											<text class="value"
												@click="popup1Fn(12,index)">{{item.rxFrquName || '请选择'}}</text>
										</view>
										<view class="params_item">
											<text>天数</text>
											<uni-easyinput class="uni-mt-5" v-model="item.days"
												placeholder="请输入"></uni-easyinput>
											<text>天</text>
										</view>
									</view>
								</view>
								<view class="add_prescription" @click="addInjection">
									加组
								</view>
							</view>
						</uni-collapse-item>
						<uni-collapse-item titleBorder="none"
							v-if="data.template.pattern == '5' || data.template.pattern == '0'">
							<template v-slot:title>
								<view class="collapseTitle">
									<img class="icons" src="@/static/img/ftcf.png" alt="" />
									敷贴处方
								</view>
							</template>
							<view class="content">
								<view class="application" v-for="(item,index) in Application.ApplicationList"
									:key="index">
									<view class="add_drug">
										<view class="search_drug">
											{{item.name1}}<text class="title">{{index+1}}</text>
											<uni-easyinput @confirm='drugSearch(item.searchKey)' prefixIcon="search"
												v-model="item.searchKey" placeholder="请输入药品名称/拼音简拼" />
											<view class="del_btn" v-if="Application.ApplicationList.length > 1"
												@click="Application.ApplicationList.splice(index,1)">
												删除
											</view>
										</view>
										<view class="search" @click.self="closeDrug"
											v-if="drugData.searchList.length > 0 && item.searchKey">
											<view class="search_result">
												<view class="search_item" @click.stop="addApp(y,index)"
													v-for="y in drugData.searchList" :key="y.id">
													<view class="drug_text">
														<view class="drug_text_title">
															<text class="name">{{y.name}}</text>
															<text class="lable">零售价：</text>
															<text class="money">￥{{y.pric}}</text>
														</view>
														<view class="drug_text_desc">
															<text>{{y.specification}}</text>
															<text>{{y.manufacturer}}</text>
															<text>库存: {{y.inventoryMin}}</text>
														</view>
													</view>
												</view>
											</view>
										</view>
									</view>
									<view class="view_ul">
										<view class="view_li" v-for="(y,i) in item.details" :key="y.id">
											<view class="li_title">
												<view class="name">
													{{y.name}}
												</view>
												<view class="number">
													<text>剂量</text>
													<uni-number-box :min="1" :value="y.rxDoscnt" />
													<text>{{y.sinDosunt}}</text>
												</view>
												<view class="detele">
													<img @click="item.details.splice(i,1)" src="@/static/img/delete.png"
														alt="" />
												</view>
											</view>
										</view>
									</view>
									<view class="params_box" v-if="item.details.length > 0">
										<view class="params_item">
											<text>名称</text>
											<uni-easyinput clearSize="12" class="uni-mt-5" trim="all"
												v-model="item.name" placeholder="请输入内容"></uni-easyinput>
										</view>
										<view class="params_item">
											<text>价格</text>
											<uni-easyinput class="uni-mt-5" v-model="item.pricePerSticker"
												placeholder="请输入"></uni-easyinput>
											<text>元</text>
										</view>
										<view class="params_item">
											<text>总贴数</text>
											<uni-easyinput class="uni-mt-5" v-model="item.quantity"
												placeholder="请输入"></uni-easyinput>
											<text>贴</text>
										</view>
										<view class="params_item">
											<text>调法</text>
											<text class="value"
												@click="popup1Fn(13,index)">{{item.modulationMethod || '请选择'}}</text>
										</view>
										<view class="params_item">
											<text>用法</text>
											<text class="value"
												@click="popup1Fn(14,index)">{{item.rxUsedWayName || '请选择'}}</text>
										</view>
										<view class="params_item">
											<text>执行天数</text>
											<uni-easyinput clearSize="12" class="uni-mt-5" trim="all"
												v-model="item.days" placeholder="请输入"></uni-easyinput>
											<text>天</text>
										</view>
										<view class="params_item">
											<text>部位</text>
											<text class="value"
												@click="popup1Fn(15,index)">{{item.applicationSite || '请选择'}}</text>
										</view>
										<view class="params_item">
											<text>医嘱</text>
											<uni-easyinput clearSize="12" class="uni-mt-5" trim="all"
												v-model="item.doctorAdvice" placeholder="请输入医嘱"></uni-easyinput>
										</view>
									</view>
								</view>
								<view class="add_prescription" @click="addApplication">
									加处方
								</view>
							</view>
						</uni-collapse-item>
						<uni-collapse-item titleBorder="none"
							v-if="data.template.pattern == '6' || data.template.pattern == '0'">
							<template v-slot:title>
								<view class="collapseTitle">
									<img class="icons" src="@/static/img/jyzl.png" alt="" />
									检验治疗
								</view>
							</template>
							<view class="content">
								<view class="add_drug">
									<view class="search_drug">
										<uni-easyinput @confirm='drugSearch(testData.testValue)' prefixIcon="search"
											v-model="testData.testValue" placeholder="请输入检验治疗/拼音简拼" />
									</view>
									<view class="search" @click.self="closeDrug"
										v-if="drugData.searchList.length > 0 && testData.testValue">
										<view class="search_result">
											<view class="search_item test" @click.stop="addTest(item)"
												v-for="item in drugData.searchList" :key="item.id">
												<view class="drug_text">
													<view class="drug_text_title">
														<text class="name">{{item.name}}</text>
													</view>
													<view class="drug_text_desc">
														<text>￥{{item.amt}}</text>/
														<text>{{item.unit}}</text>
													</view>
												</view>
											</view>
										</view>
									</view>
								</view>
								<view class="view_ul">
									<view class="view_li" v-for="(item,index) in testData.testList" :key="item.id">
										<view class="li_title">
											<view class="name">
												{{item.name}}
											</view>
											<view class="money">
												<text>单价:</text>
												<uni-easyinput clearSize="12" class="uni-mt-5" trim="all"
													v-model="item.pric" placeholder="请输入内容"></uni-easyinput>
												<text>元</text>
											</view>
											<view class="number">
												<uni-number-box :min="1" :value="item.cnt" />
												<text>{{item.unit}}</text>
											</view>
											<view class="detele">
												<img @click="testData.testList.splice(index,1)"
													src="@/static/img/delete.png" alt="" />
											</view>
										</view>
										<view class="li_params test">
											<view class="params">
												<text>医嘱</text>
												<uni-easyinput class="uni-mt-5" v-model="item.doctorAdvice"
													placeholder="请输入医嘱"></uni-easyinput>
											</view>
										</view>
									</view>
								</view>
							</view>
						</uni-collapse-item>
						<uni-collapse-item titleBorder="none"
							v-if="data.template.pattern == '8' || data.template.pattern == '0'">
							<template v-slot:title>
								<view class="collapseTitle">
									<img class="icons" src="@/static/img/ylqx.png" alt="" />
									医疗器械
								</view>
							</template>
							<view class="content">
								<view class="add_drug">
									<view class="search_drug">
										<uni-easyinput @confirm='drugSearch(Apparatus.searchKey)' prefixIcon="search"
											v-model="Apparatus.searchKey" placeholder="请输入检验治疗/拼音简拼" />
									</view>
									<view class="search" @click.self="closeDrug"
										v-if="drugData.searchList.length > 0 && Apparatus.searchKey">
										<view class="search_result">
											<view class="search_item" @click.stop="addApparatus(item)"
												v-for="item in drugData.searchList" :key="item.id">
												<view class="drug_text">
													<view class="drug_text_title">
														<text class="name">{{item.name}}</text>
														<text class="lable">零售价：</text>
														<text class="money">￥{{item.pric}}</text>
													</view>
													<view class="drug_text_desc">
														<text>{{item.specification}}</text>
														<text>{{item.manufacturer}}</text>
														<text>库存: {{item.inventoryMin}}</text>
													</view>
												</view>
											</view>
										</view>
									</view>
								</view>
								<view class="view_ul">
									<view class="view_li" v-for="(item,index) in Apparatus.ApparatusList"
										:key="item.id">
										<view class="li_title">
											<view class="name">
												{{item.name}}
											</view>
											<view class="money">
												<text>单价:</text>
												<uni-easyinput clearSize="12" class="uni-mt-5" trim="all"
													v-model="item.pric" placeholder="请输入内容"></uni-easyinput>
												<text>元</text>
											</view>
											<view class="number">
												<uni-number-box :min="1" :value="item.cnt" />
												<text>{{item.unit}}</text>
											</view>
											<view class="detele">
												<img @click="Apparatus.ApparatusList.splice(index,1)"
													src="@/static/img/delete.png" alt="" />
											</view>
										</view>
									</view>
								</view>
							</view>
						</uni-collapse-item>
						<uni-collapse-item titleBorder="none"
							v-if="data.template.pattern == '9' || data.template.pattern == '0'">
							<template v-slot:title>
								<view class="collapseTitle">
									<img class="icons" src="@/static/img/mzbl.png" alt="" />
									药品零售
								</view>
							</template>
							<view class="content">
								<view class="add_drug">
									<view class="drug_title">
										添加药品
									</view>
									<view class="search_drug">
										<uni-easyinput @confirm='drugSearch' prefixIcon="search"
											v-model="data.drugValue" placeholder="请输入药品名称/拼音简拼" />
									</view>
									<view class="search" @click.self="closeDrug"
										v-if="drugData.searchList.length > 0 && data.drugValue">
										<view class="search_result">
											<view class="search_item" @click.stop="addRetail(item)"
												v-for="item in drugData.searchList" :key="item.id">
												<view class="drug_text">
													<view class="drug_text_title">
														<text class="name">{{item.name}}</text>
														<text class="lable">零售价：</text>
														<text class="money">￥{{item.pric}}</text>
													</view>
													<view class="drug_text_desc">
														<text>{{item.specification}}</text>
														<text>{{item.manufacturer}}</text>
														<text>库存: {{item.inventoryMin}}</text>
													</view>
												</view>
											</view>
										</view>
									</view>
								</view>
								<view class="add_project">
									<view class="project_title">
										添加项目
									</view>
									<view class="search_project">
										<uni-easyinput @confirm='therapySearch' prefixIcon="search"
											v-model="data.projectValue" placeholder="请输入项目名称/拼音简码" />
									</view>
									<view class="search" @click.self="closeDrug"
										v-if="drugData.therapyList.length > 0 && data.projectValue">
										<view class="search_result">
											<view class="search_item" @click.stop="addRetail(item)"
												v-for="item in drugData.therapyList" :key="item.id">
												<view class="drug_text">
													<view class="drug_text_title">
														<text class="name">{{item.name}}</text>
													</view>
													<view class="drug_text_desc">
														<text>￥{{item.amt}}</text>/
														<text>{{item.unit}}</text>
													</view>
												</view>
											</view>
										</view>
									</view>
									<view class="view_ul">
										<view class="view_li" v-for="(item,index) in Retail.retailList" :key="item.id">
											<view class="li_title">
												<view class="name">
													{{item.name}}
												</view>
												<view class="money">
													<text>单价:</text>
													<uni-easyinput clearSize="12" class="uni-mt-5" trim="all"
														v-model="item.pric" placeholder="请输入内容"></uni-easyinput>
													<text>元</text>
												</view>
												<view class="number">
													<uni-number-box :min="1" :value="item.sinDoscnt" />
													<text>{{item.sinDosunt}}</text>
												</view>
												<view class="detele">
													<img @click="drugChange(item)" src="@/static/img/delete.png"
														alt="" />
												</view>
											</view>
											<view class="li_desc">
												<text>{{item.specification}}</text>
												<text>{{item.manufacturer}}</text>
											</view>
											<view class="li_params" v-if="item.openingInventory != undefined">
												<view class="params">
													<text>单次用量</text>
													<uni-easyinput clearSize="12" class="uni-mt-5" trim="all"
														v-model="item.sinDoscnt" placeholder="请输入内容"></uni-easyinput>
													<text class="value"
														@click="popup1Fn(16,index)">{{item.sinDosunt || '选择单位'}}</text>
												</view>
												<view class="params">
													<text>频率</text>
													<text class="value"
														@click="popup1Fn(17,index)">{{item.rxFrquName || '选择频率'}}</text>
												</view>
												<label v-if="false">
													<checkbox value="c" disabled="false" />拆零
												</label>
											</view>
										</view>
									</view>
								</view>
							</view>
						</uni-collapse-item>
					</uni-collapse>
				</view>
				<view class="popup_btn">
					<view class="close" @click="closeClick">
						取消
					</view>
					<view class="enter" @click="enterAddTemplate">
						确定
					</view>
				</view>
			</view>
		</uni-popup>
		<uni-popup ref="popup1" class="withdrawal1" :mask-click="false">
			<view class="popup-content">
				<picker-view indicator-style="height: 50px;" @change="bindChange" class="picker-view">
					<picker-view-column>
						<view class="item" v-for="item in data.selectList" :key="item.value">{{item.text}}</view>
					</picker-view-column>
				</picker-view>
				<view class="popup_btn">
					<view class="close" @click="popup1.close()">
						取消
					</view>
					<view class="enter" @click="AddTemplateType">
						确定
					</view>
				</view>
			</view>
		</uni-popup>
		<uni-popup ref="popup2" class="withdrawal2" :mask-click="false">
			<view class="popup-content">
				<div class="popup_title">
					客户信息登记
					<img @click="popup2.close()" src="@/static/img/close.png" alt="" />
				</div>
				<uni-easyinput @confirm='ApplicationSearch' prefixIcon="search" v-model="Application.searchKey"
					placeholder="请输入药品名称/拼音简拼" />
				<ul class="pay_ul">
					<li class="pay_li" v-if="Application.activeList.length > 0">
						<view class="title">
							当前选择
						</view>
						<view class="text_box">
							<view class="text_item" v-for="(item,index) in Application.activeList" :key="item.key">
								{{item.key}}
								<img @click="Application.activeList.splice(index,1)" src="@/static/img/close.png"
									alt="" />
							</view>
						</view>
					</li>
					<li class="pay_li" v-if="Application.classList.length > 0">
						<view class="title">
							请选择部位
						</view>
						<view class="text_box">
							<view class="text_item" v-for="item in Application.classList" :key="item.key"
								@click="addActive(item)">
								{{item.key}}
							</view>
						</view>
					</li>
				</ul>
				<view class="popup_btn">
					<view class="enter" @click="Addpart">
						确定
					</view>
				</view>
			</view>
		</uni-popup>
		<uni-popup ref="popup3" class="withdrawal3" :mask-click="false">
			<view class="popup-content">
				<div class="popup_title">
					诊断
					<img @click="popup3.close()" src="@/static/img/close.png" alt="" />
				</div>
				<uni-easyinput @confirm='caseSearch' prefixIcon="search" v-model="caseData.searchKey"
					placeholder="请输入药品名称/拼音简拼" />
				<ul class="pay_ul">
					<li class="pay_li" v-if="caseData.activeList.length > 0">
						<view class="title">
							当前选择
						</view>
						<view class="text_box">
							<view class="text_item" v-for="(item,index) in caseData.activeList" :key="item.id">
								{{item.name}}
								<img @click="caseData.activeList.splice(index,1)" src="@/static/img/close.png" alt="" />
							</view>
						</view>
					</li>
					<li class="pay_li" v-if="caseData.classList.length > 0">
						<view class="title">
							请选择诊断
						</view>
						<view class="text_box">
							<view class="text_item" v-for="item in caseData.classList" :key="item.id"
								@click="addCaseActive(item)">
								{{item.name}}
							</view>
						</view>
					</li>
				</ul>
				<view class="popup_btn">
					<view class="enter" @click="Addzd">
						确定
					</view>
				</view>
			</view>
		</uni-popup>
		<uni-popup ref="popup4" class="withdrawal4" :mask-click="false">
			<view class="popup-content">
				<div class="popup_title">
					<img @click="popup4.close()" src="@/static/img/close.png" alt="" />
				</div>
				<uni-easyinput v-model="caseData.searchKey" placeholder="请输入" />
				<ul class="pay_ul">
					<li class="pay_li" v-if="caseData.byTypeList.length > 0">
						<view class="text_box">
							<view class="text_item" v-for="item in caseData.byTypeList" :key="item.id"
								@click="addTypeName(item)">
								{{item.name}}
							</view>
						</view>
					</li>
				</ul>
				<view class="popup_btn">
					<view class="enter" @click="Addvalue">
						确定
					</view>
				</view>
			</view>
		</uni-popup>
	</view>
</template>

<script setup>
	import {
		getList,
		dosformSelector,
		unitFrquSelector,
		usedFrquSelector,
		usageSelector,
		specialtreatmentSelector,
		GetValueList,
		positionSelector,
		getdrugSelector,
		getListByType,
		diseaseNameSelector,
		addTemplateApi,
		deleteTemplateApi,
		detailsApi
	} from "@/api/temolate/index.js"
	import {
		gettherapySelector,
	} from "@/api/retail/index.js"
	import {
		ref,
		reactive,
		onMounted
	} from "vue"
	const popup = ref()
	const popup1 = ref()
	const popup2 = ref()
	const popup3 = ref()
	const popup4 = ref()
	const data = reactive({
		popupType: 0,
		popupIndex: null,
		childIndex: null,
		value: {
			PatternName: '',
			pattern: '',
		},
		selectValue: '',
		searchValue: '',
		projectValue: '',
		template: {
			Name: '',
			PatternName: '全模板',
			pattern: '0',
			Remark: '',
			isPersonalTemplate: false,
		},
		scrollTop: 0,
		classlist: [{
				text: '全模板',
				value: '0'
			},
			{
				text: '西药中成药处方',
				value: '2'
			},
			{
				text: '中药处方',
				value: '3'
			},
			{
				text: '注射处方',
				value: "4"
			},
			{
				text: '敷贴处方',
				value: '5'
			},
			{
				text: '检验治疗',
				value: '6'
			},
			{
				text: '病例模板',
				value: '7'
			},
			{
				text: '医疗器械',
				value: '8'
			},
			{
				text: '药品零售',
				value: '9'
			},
			{
				text: '快捷接诊',
				value: '10'
			}
		],
		selectList: [{
				text: '全模板',
				value: '0'
			},
			{
				text: '西药中成药处方',
				value: '2'
			},
			{
				text: '中药处方',
				value: '3'
			},
			{
				text: '注射处方',
				value: "4"
			},
			{
				text: '敷贴处方',
				value: '5'
			},
			{
				text: '检验治疗',
				value: '6'
			},
			{
				text: '病例模板',
				value: '7'
			},
			{
				text: '医疗器械',
				value: '8'
			},
			{
				text: '药品零售',
				value: '9'
			},
			{
				text: '快捷接诊',
				value: '10'
			},
		],
		sexs: [{
			text: '个人专用',
			value: true
		}, {
			text: '诊所共享',
			value: false
		}],
		dataList: [],
		total: 0,
		pageSize: 12,
		current: 1,
	})
	const drugData = reactive({
		drugValue: '',
		searchList: [], // 药品搜索列表
		drugList: [],
		therapyList: [],
		dosformList: [],
		unitFrquList: [],
		usedFrquList: [],
		usageList: []
	})
	const prescriptionData = reactive({
		prescriptionList: [{
			name: '处方',
			searchKey: '',
			details: [],
			quantity: '',
			rxFrquName: '',
			days: '',
			dosage: '',
			rxUsedWayName: '',
			decoctingMethod: '',
			doctorAdvice: '',
		}],
		specialtreatment: [],
		dosageList: [],
		usageList: []
	})
	const injection = reactive({
		injectionList: [{
			name1: '注射组',
			searchKey: '',
			details: [],
			rxUsedWayName: '',
			rxFrquName: '',
			days: '',

		}],
	})
	const Application = reactive({
		ApplicationList: [{
			name1: '处方',
			searchKey: '',
			details: [],
			name: '',
			pricePerSticker: '',
			quantity: '',
			modulationMethod: '',
			rxUsedWayName: '',
			days: '',
			applicationSite: '',
			doctorAdvice: '',
		}],
		PositionList: [],
		classList: [],
		activeList: [],
		transferList:[],
		searchKey: ''
	})
	const testData = reactive({
		testValue: '',
		testList: [],
	})
	const Apparatus = reactive({
		ApparatusList: [],
		searchKey: ''
	})
	const Retail = reactive({
		retailList: [],

	})
	const caseData = reactive({
		patientList: [],
		presentList: [],
		toList: [],
		allergyList: [],
		labelList: [],
		lastList: [],
		medtype: [],
		template: {
			medType: '',
			diagnosis: [],
			algsHis: '',
			chfcomp: '',
			tagIds: '',
			disposalContent: '',
			diseNow: '',
			pastHistory: '',
			otherCheck: '',
			look: '',
			upperRight: '',
			upperLeft: '',
			lowerRight: '',
			lowerLeft: '',
		},
		caseList1: [],
		caseList2: [],
		caseList3: [],
		classList: [],
		activeList: [],
		searchKey: '',
		byTypeList: [],
	})
	onMounted(() => {
		getDataList()
		getdosform()
		getunitFrqu()
		getusedFrqu()
		getusage()
		getspecialtreatment()
		getGetValueList()
		getPosition()
		getcaseList()
	})
	// 获取列表数据
	const getDataList = async () => {
		let query = {
			Current: data.current,
			Pattern: data.selectValue,
			size: data.pageSize,
			SearchKey: data.searchValue
		}
		await getList(query).then((res) => {
			if (res.code == 200) {
				data.dataList = res.data.records
				data.total = res.data.total
			}
		})
	}
	const getdosform = async () => {
		let res = await dosformSelector({})
		if (res.code == 200) {
			let arr = []
			res.data.map(item => {
				arr.push({
					text: item.key,
					value: item.value
				})
			})
			drugData.dosformList = arr
		}
	}
	const getunitFrqu = async () => {
		let res = await unitFrquSelector({})
		if (res.code == 200) {
			let arr = []
			res.data.map(item => {
				arr.push({
					text: item.key,
					value: item.value
				})
			})
			drugData.unitFrquList = arr
		}
	}
	const getusedFrqu = async () => {
		let res = await usedFrquSelector({})
		if (res.code == 200) {
			let arr = []
			res.data.map(item => {
				arr.push({
					text: item.key,
					value: item.value
				})
			})
			drugData.usedFrquList = arr
		}
	}
	const getusage = async () => {
		let res = await usageSelector({})
		if (res.code == 200) {
			let arr = []
			res.data.map(item => {
				arr.push({
					text: item.key,
					value: item.value
				})
			})
			drugData.usageList = arr
		}
	}
	const getspecialtreatment = async () => {
		let res = await specialtreatmentSelector({})
		if (res.code == 200) {
			let arr = []
			res.data.map(item => {
				arr.push({
					text: item.key,
					value: item.value
				})
			})
			prescriptionData.specialtreatment = arr
		}
	}
	const getGetValueList = async () => {
		// FTUSAGEASK  中药用法
		// OSAGE 中药用量
		let array = ['OSAGE', 'FTUSAGEASK', 'MODULATIONMETHOD', 'MEDTYPE']
		for (var i = 0; i < array.length; i++) {
			let res = await GetValueList([array[i]])
			if (res.code == 200) {
				let arr = []
				res.data.map(item => {
					arr.push({
						text: item.key,
						value: item.value
					})
				})
				if (array[i] == 'OSAGE') {
					prescriptionData.dosageList = arr
				} else if (array[i] == 'FTUSAGEASK') {
					prescriptionData.usageList = arr
				} else if (array[i] == 'MODULATIONMETHOD') {
					Application.transferList = arr
				} else {
					caseData.medtype = arr
				}
			}
		}

	}
	const getPosition = async () => {
		let res = await positionSelector({})
		if (res.code == 200) {
			Application.PositionList = res.data
		}
	}
	const gettherapyList = async () => {
		let res = await gettherapySelector({
			SearchKey: data.projectValue
		})
		if (res.code == 200) {
			drugData.therapyList = res.data
		}
	}
	const getcaseList = async () => {

		for (var i = 1; i <= 6; i++) {
			let res = await getListByType({
				type: i
			})
			if (res.code == 200) {
				if (i == 1) caseData.patientList = res.data
				else if (i == 2) caseData.presentList = res.data
				else if (i == 3) caseData.toList = res.data
				else if (i == 4) caseData.allergyList = res.data
				else if (i == 5) caseData.labelList = res.data
				else caseData.lastList = res.data
			}
		}
	}
	const popup1Fn = (type, index, childIndex) => {
		data.popupType = type
		data.popupIndex = index
		data.childIndex = childIndex

		if (type == 1) {
			data.selectList = data.classlist
		} else if (type == 2) {
			data.selectList = drugData.dosformList
		} else if (type == 3) {
			data.selectList = drugData.unitFrquList
		} else if (type == 4) {
			data.selectList = drugData.usedFrquList
		} else if (type == 5) {
			data.selectList = drugData.usageList
		} else if (type == 6) {
			data.selectList = drugData.dosformList
		} else if (type == 7) {
			data.selectList = prescriptionData.specialtreatment
		} else if (type == 8) {
			data.selectList = drugData.usedFrquList
		} else if (type == 9) {
			data.selectList = prescriptionData.dosageList
		} else if (type == 10) {
			data.selectList = prescriptionData.usageList
		} else if (type == 11) {
			data.selectList = drugData.dosformList
		} else if (type == 12) {
			data.selectList = drugData.usedFrquList
		} else if (type == 13) {
			data.selectList = Application.transferList
		} else if (type == 14) {
			data.selectList = prescriptionData.usageList
		} else if (type == 15) {
			popup2.value.open('bottom')
			return
		} else if (type == 16) {
			data.selectList = drugData.unitFrquList
		} else if (type == 17) {
			data.selectList = drugData.usedFrquList
		} else if (type == 18) {
			data.selectList = caseData.medtype
		} else if (type == 19) {
			popup3.value.open('bottom')
			return
		}

		if (data.selectList.length > 0) {
			data.value.PatternName = data.selectList[0].text
			data.value.pattern = data.selectList[0].value
		}
		popup1.value.open('bottom')
	}
	const addTemplate = () => {
		popup.value.open('bottom')
	}
	const enterAddTemplate = async () => {
		if (!data.template.Name) {
			uni.showToast({
				title: '模板名称不能为空',
				icon: 'error',
				duration: 2000
			})
			return
		}
		let CaseHistory = {}
		let Prescriptions = []
		// 中西药
		if (data.template.pattern == 2) {
			Prescriptions = [{
				rxType: 1,
				doctorAdvice: null,
				details_Fujiafei: [],
				details: drugData.drugList
			}]
			// 中药
		} else if (data.template.pattern == 3) {
			prescriptionData.prescriptionList.forEach((item, index) => {
				Prescriptions.push({
					"index": index,
					"totalPrice": 2,
					"count": 0,
					"doctorAdvice": item.doctorAdvice,
					"rxType": 3,
					"quantity": item.quantity,
					"rxFrquName": item.rxFrquName,
					"days": item.days,
					"decoctingMethod": item.decoctingMethod,
					"rxUsedWayName": item.rxUsedWayName,
					"dosage": item.dosage,
					"details": item.details,
					"details_Fujiafei": [],
					"nameDesc": ""
				})
			})
			// 注射
		} else if (data.template.pattern == 4) {
			injection.injectionList.forEach((item, index) => {
				Prescriptions.push({
					"count": "12",
					"rxType": 2,
					"rxUsedWayName": item.rxUsedWayName,
					"rxFrquName": item.rxFrquName,
					"days": item.days,
					"details": item.details,
				})
			})
			// 敷贴
		} else if (data.template.pattern == 5) {
			Application.ApplicationList.forEach((item, index) => {
				Prescriptions.push({
					"name": item.name,
					pricePerSticker: item.pricePerSticker,
					quantity: item.quantity,
					modulationMethod: item.modulationMethod,
					rxUsedWayName: item.rxUsedWayName,
					days: item.days,
					applicationSite: item.applicationSite,
					doctorAdvice: item.doctorAdvice,
					"rxType": 4,
					"details": item.details,
				})
			})
		} else if (data.template.pattern == 6) {
			Prescriptions = [{
				rxType: 5,
				doctorAdvice: null,
				details_Fujiafei: [],
				details: testData.testList
			}]
		} else if (data.template.pattern == 7) {
			CaseHistory = caseData.template
			Prescriptions = []
		} else if (data.template.pattern == 8) {
			Prescriptions = [{
				rxType: 6,
				doctorAdvice: null,
				details_Fujiafei: [],
				details: Apparatus.ApparatusList
			}]
		} else if (data.template.pattern == 9) {
			Prescriptions = [{
				itemType: data.template.Name,
				details: Retail.retailList
			}]
		}else if(data.template.pattern == 0){
			CaseHistory = caseData.template
			Prescriptions = [{
				rxType: 1,
				doctorAdvice: null,
				details_Fujiafei: [],
				details: drugData.drugList
			},{
				rxType: 5,
				doctorAdvice: null,
				details_Fujiafei: [],
				details: testData.testList
			},
			{
				itemType: data.template.Name,
				details: Retail.retailList
			}]
			Application.ApplicationList.forEach((item, index) => {
				Prescriptions.push({
					"name": item.name,
					pricePerSticker: item.pricePerSticker,
					quantity: item.quantity,
					modulationMethod: item.modulationMethod,
					rxUsedWayName: item.rxUsedWayName,
					days: item.days,
					applicationSite: item.applicationSite,
					doctorAdvice: item.doctorAdvice,
					"rxType": 4,
					"details": item.details,
				})
			})
			injection.injectionList.forEach((item, index) => {
				Prescriptions.push({
					"count": "12",
					"rxType": 2,
					"rxUsedWayName": item.rxUsedWayName,
					"rxFrquName": item.rxFrquName,
					"days": item.days,
					"details": item.details,
				})
			})
			prescriptionData.prescriptionList.forEach((item, index) => {
				Prescriptions.push({
					"index": index,
					"totalPrice": 2,
					"count": 0,
					"doctorAdvice": item.doctorAdvice,
					"rxType": 3,
					"quantity": item.quantity,
					"rxFrquName": item.rxFrquName,
					"days": item.days,
					"decoctingMethod": item.decoctingMethod,
					"rxUsedWayName": item.rxUsedWayName,
					"dosage": item.dosage,
					"details": item.details,
					"details_Fujiafei": [],
					"nameDesc": ""
				})
			})
		}
		let res = await addTemplateApi({
			Template: data.template,
			Prescriptions,
			CaseHistory,
			// Dises: caseData.template.diagnosis
		})
		console.log(res);
		if (res.code == 200) {
			closeClick()
			getDataList()
			uni.navigateTo({
				url: '/pages/template/index'
			})
		} else {
			uni.showToast({
				title: res.msg,
				icon: 'error',
				duration: 2000
			})
		}
	}
	let detele = async (id) => {
		let res = await deleteTemplateApi({
			id
		})
		if (res.code == 200) {

			getDataList()
			uni.showToast({
				title: '删除成功',
				icon: 'error',
				duration: 2000
			})
		} else {
			uni.showToast({
				title: res.msg,
				icon: 'error',
				duration: 2000
			})
		}
	}
	let details = async (id) => {

		let res = await detailsApi({
			id
		})
		if (res.code == 200) {
			data.template = {
				Name: res.data.template.name,
				PatternName: res.data.template.patternDescribe,
				pattern: res.data.template.pattern,
				Remark: res.data.template.remark,
				isPersonalTemplate: res.data.template.isPersonalTemplate,
			}
			caseData.template = res.data.caseHistory
			if (res.data.template.pattern == 2) {
				drugData.drugList = res.data.prescriptions
			} else if (res.data.template.pattern == 3) {
				res.data.prescriptions.forEach(item => {
					item.name = "处方"
					item.searchKey = ''
				})
				prescriptionData.prescriptionList = res.data.prescriptions
			} else if (res.data.template.pattern == 4) {
				res.data.prescriptions.forEach(item => {
					item.name = "注射组"
					item.searchKey = ''
				})
				injection.injectionList = res.data.prescriptions
			} else if (res.data.template.pattern == 5) {
				res.data.prescriptions.forEach(item => {
					item.name1 = "处方"
					item.searchKey = ''
				})
				Application.ApplicationList = res.data.prescriptions
			} else if (res.data.template.pattern == 6) {
				testData.testList = res.data.prescriptions
			} else if (res.data.template.pattern == 8) {
				Apparatus.ApparatusList = res.data.prescriptions
			} else if (res.data.template.pattern == 9) {
				res.data.prescriptions.forEach(item => {
					item.name = "处方"
					item.searchKey = ''
					Retail.retailList = [...Retail.retailList, ...item.details]
				})
			} else if (res.data.template.pattern == 0) {

			}

			popup.value.open('bottom')
		} else {
			uni.showToast({
				title: res.msg,
				icon: 'error',
				duration: 2000
			})
		}
	}
	const bindChange = (e) => {
		const value = e.detail.value[0]
		console.log(value);
		data.selectList.forEach((item, index) => {
			if (index == value) {
				data.value.PatternName = item.text
				data.value.pattern = item.value
			}
		})
	}
	const AddTemplateType = () => {
		if (data.popupType == 1) {
			data.template.PatternName = data.value.PatternName
			data.template.pattern = data.value.pattern
		} else if (data.popupType == 2) {
			drugData.drugList.forEach((item, index) => {
				if (index == data.popupIndex) {
					item.dosageForm = data.value.PatternName
				}
			})
		} else if (data.popupType == 3) {
			drugData.drugList.forEach((item, index) => {
				if (index == data.popupIndex) {
					item.sinDosunt = data.value.PatternName
				}
			})
		} else if (data.popupType == 4) {
			drugData.drugList.forEach((item, index) => {
				if (index == data.popupIndex) {
					item.rxFrquName = data.value.PatternName
				}
			})
		} else if (data.popupType == 5) {
			drugData.drugList.forEach((item, index) => {
				if (index == data.popupIndex) {
					item.rxUsedWayName = data.value.PatternName
				}
			})
		} else if (data.popupType == 6) {
			prescriptionData.prescriptionList.forEach((item, index) => {
				if (index == data.popupIndex) {
					item.details.forEach((y, i) => {
						if (i == data.childIndex) {
							y.dosageForm = data.value.PatternName
						}
					})
				}
			})
		} else if (data.popupType == 7) {
			prescriptionData.prescriptionList.forEach((item, index) => {
				if (index == data.popupIndex) {
					item.details.forEach((y, i) => {
						if (i == data.childIndex) {
							y.specialTreatment = data.value.PatternName
						}
					})
				}
			})
		} else if (data.popupType == 8) {
			prescriptionData.prescriptionList.forEach((item, index) => {
				if (index == data.popupIndex) {
					item.rxFrquName = data.value.PatternName
				}
			})
		} else if (data.popupType == 9) {
			prescriptionData.prescriptionList.forEach((item, index) => {
				if (index == data.popupIndex) {
					item.dosage = data.value.PatternName
				}
			})
		} else if (data.popupType == 10) {
			prescriptionData.prescriptionList.forEach((item, index) => {
				if (index == data.popupIndex) {
					item.rxUsedWayName = data.value.PatternName
				}
			})
		} else if (data.popupType == 11) {
			injection.injectionList.forEach((item, index) => {
				if (index == data.popupIndex) {
					item.details.forEach((y, i) => {
						if (i == data.childIndex) {
							y.dosageForm = data.value.PatternName
						}
					})
				}
			})
		} else if (data.popupType == 12) {
			injection.injectionList.forEach((item, index) => {
				if (index == data.popupIndex) {
					item.rxFrquName = data.value.PatternName
				}
			})
		} else if (data.popupType == 13) {
			Application.ApplicationList.forEach((item, index) => {
				if (index == data.popupIndex) {
					item.modulationMethod = data.value.PatternName
				}
			})
		} else if (data.popupType == 14) {
			Application.ApplicationList.forEach((item, index) => {
				if (index == data.popupIndex) {
					item.rxUsedWayName = data.value.PatternName
				}
			})
		} else if (data.popupType == 16) {
			Retail.retailList.forEach((item, index) => {
				if (index == data.popupIndex) {
					item.sinDosunt = data.value.PatternName
				}
			})
		} else if (data.popupType == 17) {
			Retail.retailList.forEach((item, index) => {
				if (index == data.popupIndex) {
					item.rxFrquName = data.value.PatternName
				}
			})
		} else if (data.popupType == 18) {
			let array = caseData.medtype.filter(item => item.text == data.value.PatternName)
			if (array.length > 0) caseData.template.medType = array[0].value
			else caseData.template.medType = ''

		}
		popup1.value.close()
	}
	// 中西成药
	const getdrugList = async (id, type) => {
		let arr = []
		if (data.template.pattern == '0') arr = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 999]
		else if (data.template.pattern == '2') arr = [1]
		else if (data.template.pattern == '3') arr = [4, 5, 6, 7]
		else if (data.template.pattern == '4') arr = [2]
		else if (data.template.pattern == '5') arr = [7]
		else if (data.template.pattern == '6') arr = []
		else if (data.template.pattern == '7') arr = []
		let res = await getdrugSelector({
			searchKey: drugData.drugValue,
			category: arr
		})
		if (res.code == 200) {
			drugData.searchList = res.data
		}
	}
	const drugSearch = (res) => {
		drugData.searchValue = res
		getdrugList()
	}
	const addDrug = (row) => {
		if (drugData.drugList.some(item => item.id == row.id)) {
			uni.showToast({
				title: '药品/项目已存在',
				duration: 2000,
				icon: 'error',
			});
		} else {
			drugData.drugList.push(row)
		}
	}
	const drugChange = (row) => {
		let bool = drugData.drugList.findIndex(item => item.name == row.name)
		drugData.drugList.splice(bool, 1)
	}
	const closeDrug = () => {
		drugData.drugValue = ''
		drugData.searchList = []
		injection.injectionList.forEach(item => {
			item.searchKey = ''
		})
		prescriptionData.prescriptionList.forEach(item => {
			item.searchKey = ''
		})
		Application.ApplicationList.forEach(item => {
			item.searchKey = ''
		})
		Apparatus.searchKey = ''
		data.projectValue = ''
	}
	// 中药处方
	const addPrescription = () => {
		prescriptionData.prescriptionList.push({
			name: '处方',
			searchKey: '',
			details: []
		})
	}
	const addPre = (row, index) => {
		if (prescriptionData.prescriptionList[index].details.some(item => item.id == row.id)) {
			uni.showToast({
				title: '药品/项目已存在',
				duration: 2000,
				icon: 'error',
			});
		} else {
			prescriptionData.prescriptionList[index].details.push(row)
		}
	}
	// 注射处方
	const addInjection = () => {
		injection.injectionList.push({
			name: '注射组',
			searchKey: '',
			details: []
		})
	}
	const addInje = (row, index) => {
		console.log(row);
		if (injection.injectionList[index].details.some(item => item.id == row.id)) {
			uni.showToast({
				title: '药品/项目已存在',
				duration: 2000,
				icon: 'error',
			});
		} else {
			injection.injectionList[index].details.push(row)
		}
	}
	// 敷贴
	const addApplication = () => {
		Application.ApplicationList.push({
			name: '处方',
			searchKey: '',
			details: []
		})
	}
	const addApp = (row, index) => {
		if (Application.ApplicationList[index].details.some(item => item.id == row.id)) {
			uni.showToast({
				title: '药品/项目已存在',
				duration: 2000,
				icon: 'error',
			});
		} else {
			Application.ApplicationList[index].details.push(row)
		}
	}
	const addActive = (row) => {
		if (Application.activeList.some(item => item.key == row.key)) {
			uni.showToast({
				title: '已存在',
				duration: 2000,
				icon: 'error',
			});
		} else {
			Application.activeList.push(row)
		}
	}
	const ApplicationSearch = () => {
		Application.classList = Application.PositionList.filter(item => item.key.includes(Application.searchKey))
	}
	const Addpart = () => {
		let arr = []
		Application.activeList.forEach(item => {
			arr.push(item.key)
		})
		Application.ApplicationList.forEach((item, index) => {
			if (index == data.popupIndex) {
				item.applicationSite = arr.join()
			}
		})
		Application.searchKey = ''
		popup2.value.close()
	}
	// 检验治疗
	const addTest = (row) => {
		if (testData.testList.some(item => item.id == row.id)) {
			uni.showToast({
				title: '药品/项目已存在',
				duration: 2000,
				icon: 'error',
			});
		} else {
			testData.testList.push(row)
		}
	}

	// 医疗器械
	const addApparatus = row => {
		if (Apparatus.ApparatusList.some(item => item.id == row.id)) {
			uni.showToast({
				title: '药品/项目已存在',
				duration: 2000,
				icon: 'error',
			});
		} else {
			Apparatus.ApparatusList.push(row)
		}
	}
	//药品零售
	const addRetail = (row) => {
		if (Retail.retailList.some(item => item.id == row.id)) {
			uni.showToast({
				title: '药品/项目已存在',
				duration: 2000,
				icon: 'error',
			});
		} else {
			Retail.retailList.push(row)
		}
	}
	const therapySearch = () => {
		gettherapyList()
	}
	// 病例
	const addCaseActive = (row) => {
		if (caseData.activeList.some(item => item.id == row.id)) {
			uni.showToast({
				title: '已存在',
				duration: 2000,
				icon: 'error',
			});
		} else {
			caseData.activeList.push(row)
		}
	}
	const caseSearch = async () => {
		let res = await diseaseNameSelector({
			searchKey: caseData.searchKey
		})
		if (res.code == 200) {
			caseData.classList = res.data
		} else {
			uni.showToast({
				title: res.msg,
				duration: 2000,
				icon: 'error',
			});
		}
	}
	const Addzd = () => {
		let arr = []
		caseData.activeList.forEach(item => {
			arr.push(item.name)
		})
		caseData.template.diagnosis = arr
		caseData.searchKey = ''
		popup3.value.close()
	}
	const popup4Fn = (type) => {
		caseData.typeIndex = type
		if (type == 1) {
			caseData.searchKey = caseData.template.algsHis
			caseData.byTypeList = caseData.allergyList
		} else if (type == 2) {
			caseData.searchKey = caseData.template.chfcomp
			caseData.byTypeList = caseData.patientList
		} else if (type == 3) {
			caseData.searchKey = caseData.template.tagIds
			caseData.byTypeList = caseData.labelList
		}
		popup4.value.open('bottom')
	}
	const addTypeName = (row) => {
		let bool = ''
		if (caseData.typeIndex == 1) {
			bool = caseData.caseList1.some(item => item.id == row.id)
		} else if (caseData.typeIndex == 2) {
			bool = caseData.caseList2.some(item => item.id == row.id)
		} else if (caseData.typeIndex == 3) {
			bool = caseData.caseList3.some(item => item.id == row.id)
		}
		if (!bool) {
			if (caseData.typeIndex == 1) {
				caseData.caseList1.push(row)
			} else if (caseData.typeIndex == 2) {
				caseData.caseList2.push(row)
			} else if (caseData.typeIndex == 3) {
				caseData.caseList3.push(row)
			}
			caseData.searchKey += ` ${row.name}`
		} else {
			uni.showToast({
				title: '已选择，请勿重复选择',
				icon: 'error',
				duration: 2000
			})
		}
	}
	const Addvalue = () => {
		if (caseData.typeIndex == 1) {
			caseData.template.algsHis = caseData.searchKey
		} else if (caseData.typeIndex == 2) {
			caseData.template.chfcomp = caseData.searchKey
		} else if (caseData.typeIndex == 3) {
			caseData.template.tagIds = caseData.searchKey
		}
		popup4.value.close()
		caseData.searchKey = ''
	}

	// 关闭
	const closeClick = () => {
		popup.value.close()

		data.popupType = 0
		data.popupIndex = null
		data.childIndex = null
		data.value = {
			PatternName: '',
			pattern: '',
		}
		data.searchValue = ''
		data.projectValue = ''
		data.template = {
			Name: '',
			PatternName: '全模板',
			pattern: '0',
			Remark: '',
			isPersonalTemplate: false,
		}
		data.scrollTop = 0


		drugData.drugValue = ''
		drugData.searchList = [] // 药品搜索列表
		drugData.drugList = []

		prescriptionData.prescriptionList = [{
			name: '处方',
			searchKey: '',
			details: [],
			quantity: '',
			rxFrquName: '',
			days: '',
			dosage: '',
			rxUsedWayName: '',
			decoctingMethod: '',
			doctorAdvice: '',
		}]
		injection.injectionList = [{
			name1: '注射组',
			searchKey: '',
			details: [],
			rxUsedWayName: '',
			rxFrquName: '',
			days: '',
		}]
		Application.ApplicationList = [{
			name1: '处方',
			searchKey: '',
			details: [],
			name: '',
			pricePerSticker: '',
			quantity: '',
			modulationMethod: '',
			rxUsedWayName: '',
			days: '',
			applicationSite: '',
			doctorAdvice: '',
		}]
		testData.testValue = ''
		testData.testList = []
		Apparatus.ApparatusList = []
		Apparatus.searchKey = ''
		Retail.retailList = []
		caseData.template = {
			medType: '',
			diagnosis: [],
			algsHis: '',
			chfcomp: '',
			tagIds: '',
			disposalContent: '',
			diseNow: '',
			pastHistory: '',
			otherCheck: '',
			look: '',
			upperRight: '',
			upperLeft: '',
			lowerRight: '',
			lowerLeft: '',
		}
		caseData.caseList1 = []
		caseData.caseList2 = []
		caseData.caseList3 = []
		caseData.classList = []
		caseData.activeList = []
		caseData.searchKey = ''
		caseData.byTypeList = []
	}
</script>

<style lang="scss" scoped>
	.template {
		width: 100%;
		height: 100vh;
		background-color: #f1f1f1;

		::v-deep .search_input {
			padding: 15rpx 20rpx;
			box-sizing: border-box;
			background-color: #fff;
			box-shadow: 0rpx 3rpx 5rpx 0rpx #ccc;
			position: sticky;
			top: 0;
			z-index: 99;
			display: flex;
			align-items: center;

			.uni_select {
				.uni-select {
					border: unset;
				}

				width: 190rpx;

				.uni-select__selector {
					.uni-select__selector-scroll {
						.uni-select__selector-item {
							font-size: 20rpx;
						}
					}
				}
			}

			.uni-easyinput {
				margin-left: 10rpx;

				.uni-easyinput__content {
					border: unset;
					background-color: #f1f1f1 !important;
				}

			}

			.add_btn {
				width: 110rpx;
				font-size: 24rpx;
				text-align: center;
				line-height: 50rpx;
				margin-left: 10rpx;
				border-radius: 4rpx;
				color: #fff;
				background-color: #07c160;
			}
		}

		.scroll_Y {
			width: 100%;
			margin-top: 6rpx;

			.scroll-view-item {
				width: 100%;
				background-color: #fff;
				padding: 20rpx 20rpx;
				box-sizing: border-box;
				margin-bottom: 2rpx;
				font-size: 26rpx;
				display: flex;
				align-items: center;
				justify-content: space-between;

				.templateInfo {
					width: 70%;
					display: flex;
					align-items: center;
					justify-content: space-between;

					text {
						width: 50%;
						overflow: hidden;
						text-overflow: ellipsis;
						white-space: nowrap;
						font-size: 26rpx;
					}
				}

				.templateBtn {
					width: 30%;
					display: flex;
					align-items: center;
					justify-content: space-between;

					text {
						background-color: #409eff;
						padding: 10rpx 25rpx;
						box-sizing: border-box;
						color: #fff;
					}

					.del {
						background-color: red;
					}
				}
			}
		}

		::v-deep .withdrawal {
			.popup-content {
				height: 90vh;
				background-color: #fff;
				border-radius: 15rpx 15rpx 0rpx 0rpx;
				position: relative;

				.popup_title {
					font-size: 35rpx;
					font-weight: 700;
					display: flex;
					height: 100rpx;
					align-items: center;
					justify-content: center;
					border-radius: 15rpx 15rpx 0rpx 0rpx;
					position: relative;
					border-bottom: 1rpx solid #ccc;

					image {
						width: 40rpx;
						height: 40rpx;
						position: absolute;
						top: 10rpx;
						right: 15rpx;
					}
				}

				.collapseTitle {
					display: flex;
					align-items: center;
					height: 80rpx;
					line-height: 80rpx;
					border-bottom: 1rpx #eeeeee solid;
					font-weight: 600;

					.icons {
						width: 40rpx;
						height: 40rpx;
						margin: 0rpx 10rpx 0rpx 15rpx;
					}
				}

				.add_temelate {
					height: 73vh;
					overflow-x: hidden;
					overflow-y: auto;

					.uni-forms {
						width: 100%;

						.uni-forms-item {
							width: 100%;
							padding-left: 15rpx;
							box-sizing: border-box;
							margin-bottom: 0rpx;
							border-bottom: 1rpx #f1f1f1 solid;
							display: flex;
							align-items: center;

							.uni-forms-item__label {
								width: 150rpx !important;
							}

							.uni-forms-item__content {
								.uni-easyinput {
									margin-right: 15rpx;
									flex: unset;

									.is-input-border {
										border: unset;
									}
								}

								.templateType {
									width: 100%;
									font-size: 26rpx;
									padding-left: 20rpx;
								}
							}

							&:last-child {

								.uni-forms-item__label {
									text {
										display: none;
									}
								}
							}

							&:nth-child(11) {
								display: none;
							}

							&:nth-child(6) {
								display: flex;
								flex-direction: column;
								justify-content: left;
								align-items: unset;

								.uni-forms-item__content {
									display: flex;
									align-items: center;
									justify-content: space-between;

									.uni-easyinput {
										border: 1rpx solid #ccc;
										margin: 15rpx 15rpx 15rpx 0rpx;
									}

									.input {
										width: 380rpx;
										display: flex;
										align-items: center;
										flex-wrap: wrap;

										.uni-easyinput {
											border: unset;
											width: 120rpx;
											margin: 0;

											&:nth-child(1) {
												border-bottom: 1rpx solid #ccc;
												border-right: 1rpx solid #ccc;
											}

											&:nth-child(2) {
												border-bottom: 1rpx solid #ccc;
											}

											&:nth-child(3) {
												border-right: 1rpx solid #ccc;
											}
										}
									}
								}
							}
						}


					}

					.add_drug {
						padding: 20rpx 20rpx 0rpx;
						box-sizing: border-box;
						background-color: #fff;
						position: relative;

						.search_drug {
							margin-top: 20rpx;
							display: flex;
							align-items: center;
							padding-bottom: 20rpx;
							border-bottom: 1px #ccc solid;

							.title {
								color: red;
							}

							.del_btn {
								width: 100rpx;
								border: 1rpx solid red;
								color: red;
								text-align: center;
								font-size: 26rpx;
								line-height: 50rpx;
								margin-left: 10rpx;
							}
						}

						.search {
							position: fixed;
							top: 0;
							left: 0;
							width: 100vw;
							height: 100vh;
							z-index: 99;

							.search_result {
								width: 710rpx;
								max-height: 40vh;
								overflow-y: auto;
								padding: 20rpx 0rpx;
								font-size: 26rpx;
								position: absolute;
								background-color: #fff;
								top: 425rpx;
								left: 20rpx;
								border: 1rpx solid #f1f1f1;

								.search_item {
									.drug_text {
										.drug_text_title {
											.dispensing {
												font-size: 22rpx;
												padding: 6rpx;
												border-radius: 6rpx;
												color: #FFFFFF;
											}

											.green {
												background-color: limegreen;
											}

											.red {

												background-color: red;
											}

											.name {
												font-weight: 700;
												padding: 0rpx 15rpx;
											}

											.lable {
												color: #888888;
												padding: 0rpx 8rpx;
											}

											.money {
												color: red;
											}
										}

										.drug_text_desc {
											margin-top: 8rpx;
											color: #888888;

											text:last-child {
												margin-left: 10rpx;
											}
										}
									}
								}

								.test {
									height: 70rpx;
									line-height: 70rpx;

									.drug_text {
										display: flex;
										align-items: center;
										justify-content: space-between;
									}
								}
							}
						}
					}

					.add_prescription {
						width: 130rpx;
						height: 60rpx;
						line-height: 60rpx;
						color: #68b983;
						border-radius: 6rpx;
						border: 1rpx solid #68b983;
						font-size: 26rpx;
						text-align: center;
						margin: 15rpx auto;
					}

					.view_ul {
						width: 100%;

						.view_li {
							width: 100%;
							padding: 10rpx 0rpx 20rpx;
							box-sizing: border-box;

							.li_title {
								display: flex;
								align-items: center;
								justify-content: space-around;

								.name {
									width: 200rpx;
									font-weight: bold;
								}

								.money {
									display: flex;
									align-items: center;

									.uni-easyinput {
										margin-right: 15rpx;
										flex: unset;
										width: 100rpx;
										border-bottom: 1rpx #ccc solid;

										.is-input-border {
											border: unset;
										}
									}

									text {
										font-size: 26rpx;

										&:last-child {
											color: red;
										}
									}
								}

								.number {
									display: flex;
									align-items: center;
									font-size: 26rpx;

									.uni-numbox__value {
										width: 65rpx;
									}

									.uni-numbox-btns {
										padding: 0 14rpx;
									}
								}

								.detele {

									image {
										width: 65rpx;
										height: 65rpx;
									}
								}
							}

							.li_desc {
								font-size: 24rpx;
								color: #ccc;
								padding-left: 20rpx;

								text {
									margin-right: 8 rpx;
								}
							}

							.li_params {
								display: flex;
								align-items: center;
								font-size: 26rpx;
								padding-left: 30rpx;

								.params {
									display: flex;
									align-items: center;

									.value {
										width: 160rpx;
										border-bottom: 1rpx #ccc solid;
										margin-right: 15rpx;
										line-height: 70rpx;
										padding-left: 10rpx;

									}

									.uni-easyinput {
										flex: unset;
										width: 150rpx;
										border-bottom: 1rpx #ccc solid;
										margin-right: 15rpx;

										.uni-easyinput__content {
											background-color: #fff !important;
										}

										.is-input-border {
											border: unset;
										}
									}
								}

								.use {
									margin-left: 20rpx;
									display: flex;
									align-items: center;
								}
							}

							.test {
								padding-left: 0rpx;

								.params {
									margin: 0rpx 20rpx;
									border: 1rpx #ccc solid;
									border-radius: 6rpx;
									width: 100%;
									padding-left: 10rpx;

									.uni-easyinput {
										flex: 1;
										width: 100%;
										border: unset;
									}
								}
							}
						}
					}

					.add_project {
						margin-top: 20rpx;
						padding: 20rpx 20rpx 0rpx;
						box-sizing: border-box;
						background-color: #fff;


						.search_project {
							margin-top: 20rpx;
							padding-bottom: 20rpx;
							border-bottom: 1rpx #ccc solid;
						}

						.search {
							position: fixed;
							top: 0;
							left: 0;
							width: 100vw;
							height: 100vh;
							z-index: 99;

							.search_result {
								width: 710rpx;
								max-height: 40vh;
								overflow-y: auto;
								padding: 20rpx 0rpx;
								font-size: 26rpx;
								position: absolute;
								background-color: #fff;
								top: 425rpx;
								left: 20rpx;
								border: 1rpx solid #f1f1f1;

								.search_item {
									.drug_text {
										display: flex !important;
										align-items: center;
										justify-content: space-between;
										padding: 0rpx 15rpx;
										box-sizing: border-box;

										.drug_text_title {
											.name {
												font-weight: 700;
												padding: 0rpx 15rpx;
											}

											.lable {
												color: #888888;
												padding: 0rpx 8rpx;
											}

											.money {
												color: red;
											}
										}

										.drug_text_desc {
											margin-top: 8rpx;
											color: #888888;

											text:last-child {
												margin-left: 10rpx;
											}
										}
									}
								}

								.test {
									height: 70rpx;
									line-height: 70rpx;

									.drug_text {
										display: flex;
										align-items: center;
										justify-content: space-between;
									}
								}
							}
						}
					}

					.params_box {
						display: flex;
						flex-wrap: wrap;
						width: 100%;
						align-items: center;
						justify-content: space-between;
						padding: 0rpx 15rpx;
						box-sizing: border-box;

						.params_item {
							width: 32%;
							display: flex;
							height: 60rpx;
							line-height: 60rpx;
							align-items: center;
							border: 1rpx sandybrown solid;
							margin-top: 15rpx;
							padding: 0rpx 15rpx;
							box-sizing: border-box;
							border-radius: 6rpx;

							.value {
								max-width: 65%;
								padding-left: 15rpx;
								overflow: hidden;
								text-overflow: ellipsis;
								white-space: nowrap;
							}

							.uni-easyinput {
								border: unset;

								.uni-easyinput__content {
									background-color: #fff !important;

									.uni-easyinput__content-input {
										height: 55rpx !important;
										line-height: 55rpx !important;
										font-size: 26rpx;
									}

									.content-clear-icon {
										display: none;
									}
								}

								.is-input-border {
									border: unset;
								}
							}

							&:last-child {
								width: 100%;
								border: 1rpx solid #ccc;
							}
						}
					}
				}

				.injection {
					.params_box {
						.params_item {
							&:last-child {
								width: 32%;
								border: 1rpx solid sandybrown;
							}
						}
					}
				}

				.application {
					.params_box {
						.params_item {
							&:nth-child(7) {
								width: 100%;
							}
						}
					}
				}

				.popup_btn {
					width: 100%;
					position: absolute;
					bottom: 0rpx;
					left: 0rpx;
					background-color: #FFFFFF;
					display: flex;
					align-items: center;
					justify-content: center;
					border-top: 1rpx solid #f1f1f1;
					padding: 15rpx 0rpx;

					view {
						width: 45%;
						font-size: 28rpx;
						line-height: 70rpx;
						text-align: center;
						border: 1rpx solid deepskyblue;
					}

					.close {
						color: deepskyblue;
					}

					.enter {
						color: #fff;
						background-color: deepskyblue;
						margin-left: 20rpx;
					}
				}
			}
		}

		::v-deep .withdrawal1 {
			.popup-content {
				height: 40vh;
				background-color: #fff;
				border-radius: 15rpx 15rpx 0rpx 0rpx;
				position: relative;

				.picker-view {
					height: 100%;
					margin-top: 20rpx;
				}

				.item {
					line-height: 100rpx;
					text-align: center;
					font-size: 26rpx;
				}

				.popup_btn {
					width: 100%;
					position: absolute;
					bottom: 0rpx;
					left: 0rpx;
					background-color: #FFFFFF;
					display: flex;
					align-items: center;
					justify-content: center;
					border-top: 1rpx solid #f1f1f1;
					padding: 15rpx 0rpx;

					view {
						width: 45%;
						font-size: 28rpx;
						line-height: 70rpx;
						text-align: center;
						border: 1rpx solid deepskyblue;
					}

					.close {
						color: deepskyblue;
					}

					.enter {
						color: #fff;
						background-color: deepskyblue;
						margin-left: 20rpx;
					}
				}
			}
		}

		::v-deep .withdrawal2 {
			.popup-content {
				height: 80vh;
				background-color: #fff;
				border-radius: 15rpx 15rpx 0rpx 0rpx;
				overflow-y: auto;

				.popup_title {
					font-size: 35rpx;
					font-weight: 700;
					display: flex;
					height: 100rpx;
					align-items: center;
					justify-content: center;
					border-radius: 15rpx 15rpx 0rpx 0rpx;
					position: relative;
					border-bottom: 1rpx solid #ccc;

					image {
						width: 40rpx;
						height: 40rpx;
						position: absolute;
						top: 10rpx;
						right: 15rpx;
					}
				}

				.uni-easyinput {
					margin-right: 15rpx;
					flex: unset;
					border-bottom: 1rpx #ccc solid;

					.uni-easyinput__content-input {
						font-size: 26rpx;
						padding: 0rpx 20rpx;
					}

					.content-clear-icon {
						display: none;
					}

					.is-input-border {
						border: unset;
					}
				}

				.pay_ul {
					margin-bottom: 100rpx;
					font-size: 26rpx;

					.pay_li {
						margin-top: 20rpx;

						.title {
							font-size: 28rpx;
						}

						.text_box {
							display: flex;
							flex-wrap: wrap;
							align-items: center;
							padding: 15rpx;
							box-sizing: border-box;

							.text_item {
								display: flex;
								align-items: center;
								padding: 10rpx 15rpx;
								box-sizing: border-box;
								border: 1rpx solid deepskyblue;
								border-radius: 6rpx;
								margin-right: 10rpx;
								margin-bottom: 15rpx;

								image {
									width: 30rpx;
									height: 30rpx;
								}
							}
						}

						&:first-child {
							.text_box {
								.text_item {
									border: unset;
									background-color: #f1f1f1;
								}
							}
						}
					}
				}

				.popup_btn {
					width: 100%;
					position: absolute;
					bottom: 0rpx;
					left: 0rpx;
					background-color: #FFFFFF;
					display: flex;
					align-items: center;
					justify-content: center;
					border-top: 1rpx solid #f1f1f1;
					padding: 15rpx 0rpx;
					box-sizing: border-box;

					view {
						width: 100%;
						font-size: 28rpx;
						line-height: 70rpx;
						margin: 0rpx 20rpx;
						text-align: center;
						border: 1rpx solid deepskyblue;
					}

					.enter {
						color: #fff;
						background-color: deepskyblue;
					}
				}
			}
		}

		::v-deep .withdrawal3 {
			.popup-content {
				height: 80vh;
				background-color: #fff;
				border-radius: 15rpx 15rpx 0rpx 0rpx;
				overflow-y: auto;

				.popup_title {
					font-size: 35rpx;
					font-weight: 700;
					display: flex;
					height: 100rpx;
					align-items: center;
					justify-content: center;
					border-radius: 15rpx 15rpx 0rpx 0rpx;
					position: relative;
					border-bottom: 1rpx solid #ccc;

					image {
						width: 40rpx;
						height: 40rpx;
						position: absolute;
						top: 10rpx;
						right: 15rpx;
					}
				}

				.uni-easyinput {
					margin-right: 15rpx;
					flex: unset;
					border-bottom: 1rpx #ccc solid;

					.uni-easyinput__content-input {
						font-size: 26rpx;
						padding: 0rpx 20rpx;
					}

					.content-clear-icon {
						display: none;
					}

					.is-input-border {
						border: unset;
					}
				}

				.pay_ul {
					margin-bottom: 100rpx;
					font-size: 26rpx;

					.pay_li {
						margin-top: 20rpx;

						.title {
							font-size: 28rpx;
						}

						.text_box {
							display: flex;
							flex-wrap: wrap;
							align-items: center;
							padding: 15rpx;
							box-sizing: border-box;

							.text_item {
								display: flex;
								align-items: center;
								padding: 10rpx 15rpx;
								box-sizing: border-box;
								border: 1rpx solid deepskyblue;
								border-radius: 6rpx;
								margin-right: 10rpx;
								margin-bottom: 15rpx;

								image {
									width: 30rpx;
									height: 30rpx;
								}
							}
						}

						&:first-child {
							.text_box {
								.text_item {
									border: unset;
									background-color: #f1f1f1;
								}
							}
						}
					}
				}

				.popup_btn {
					width: 100%;
					position: absolute;
					bottom: 0rpx;
					left: 0rpx;
					background-color: #FFFFFF;
					display: flex;
					align-items: center;
					justify-content: center;
					border-top: 1rpx solid #f1f1f1;
					padding: 15rpx 0rpx;
					box-sizing: border-box;

					view {
						width: 100%;
						font-size: 28rpx;
						line-height: 70rpx;
						margin: 0rpx 20rpx;
						text-align: center;
						border: 1rpx solid deepskyblue;
					}

					.enter {
						color: #fff;
						background-color: deepskyblue;
					}
				}
			}
		}

		::v-deep .withdrawal4 {
			.popup-content {
				height: 40vh;
				background-color: #fff;
				border-radius: 15rpx 15rpx 0rpx 0rpx;
				overflow-y: auto;

				.popup_title {
					font-size: 35rpx;
					font-weight: 700;
					display: flex;
					height: 100rpx;
					align-items: center;
					justify-content: center;
					border-radius: 15rpx 15rpx 0rpx 0rpx;
					position: relative;
					border-bottom: 1rpx solid #ccc;

					image {
						width: 40rpx;
						height: 40rpx;
						position: absolute;
						top: 10rpx;
						right: 15rpx;
					}
				}

				.uni-easyinput {
					margin-right: 15rpx;
					flex: unset;
					border-bottom: 1rpx #ccc solid;

					.uni-easyinput__content-input {
						font-size: 26rpx;
						padding: 0rpx 20rpx;
					}

					.content-clear-icon {
						display: none;
					}

					.is-input-border {
						border: unset;
					}
				}

				.pay_ul {
					margin-bottom: 100rpx;
					font-size: 26rpx;

					.pay_li {
						margin-top: 20rpx;

						.text_box {
							display: flex;
							flex-wrap: wrap;
							align-items: center;
							padding: 15rpx;
							box-sizing: border-box;

							.text_item {
								display: flex;
								align-items: center;
								padding: 10rpx 15rpx;
								box-sizing: border-box;
								border: 1rpx solid deepskyblue;
								border-radius: 6rpx;
								margin-right: 10rpx;
								margin-bottom: 15rpx;

								image {
									width: 30rpx;
									height: 30rpx;
								}
							}
						}
					}
				}

				.popup_btn {
					width: 100%;
					position: absolute;
					bottom: 0rpx;
					left: 0rpx;
					background-color: #FFFFFF;
					display: flex;
					align-items: center;
					justify-content: center;
					border-top: 1rpx solid #f1f1f1;
					padding: 15rpx 0rpx;
					box-sizing: border-box;

					view {
						width: 100%;
						font-size: 28rpx;
						line-height: 70rpx;
						margin: 0rpx 20rpx;
						text-align: center;
						border: 1rpx solid deepskyblue;
					}

					.enter {
						color: #fff;
						background-color: deepskyblue;
					}
				}
			}
		}

	}
</style>